package com.hc.sys;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.GsonHttpMessageConverter;

import com.google.gson.GsonBuilder;

@Configuration
public class GsonConfig {

	/**
	 * 配置gson替换jackson
	 * @return
	 */
	@Bean
	public GsonHttpMessageConverter gsonHttpMessageConverter() {
		GsonHttpMessageConverter converter = new GsonHttpMessageConverter();
		converter.setGson(new GsonBuilder()
				.serializeNulls()
				.setDateFormat("yyyy-MM-dd HH:mm")
				.create());
		return converter;
	}
}
